<?php
//Swoole\Runtime::enableCoroutine($flags = SWOOLE_HOOK_ALL);
Co::set(['hook_flags'=> SWOOLE_HOOK_ALL]); // v4.4+版本使用此方法。
$mysqlConfig = [
    'host' => '127.0.0.1',
    'port' => '3307',
    'dbname' => 'swoole_test',
    'username' => 'root',
    'password' => '123456',
];

$configStr = "mysql:host={$mysqlConfig['host']};port={$mysqlConfig['port']};dbname={$mysqlConfig['dbname']}";



for ($i = 0; $i < 5; $i++) {
    go(function () use($pdo,$configStr,$mysqlConfig){
        $pdo = new PDO($configStr, $mysqlConfig['username'], $mysqlConfig['password']);
        $res = $pdo->query("select * from test_order where `desc` like '%consequuntur consectetur333%';");
    });
}

echo "执行完成\n";